package com.av.bcacc.javaapi.thread.ticket;

public class TicketRunnable implements Runnable {

    private int ticketCount = 100;//票的数量

    @Override
    public void run() {
        while (true) {
            if (ticketCount <= 0) {
                break;
            }
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            ticketCount--;
            System.out.println(Thread.currentThread().getName() + "在售票，还剩" + ticketCount + "张票");
        }

    }
}
